package org.ctd.springframework.beans.factory.parsing.extractor.source;

import com.ctd.springframework.core.io.Resource;
import com.sun.istack.internal.Nullable;

/**
 * 资源提取
 * SourceExtractor
 *
 * @author chentudong
 * @date 2020/9/14 10:43
 * @since 1.0
 */
@FunctionalInterface
public interface SourceExtractor {
    /**
     * Extract the source metadata from the candidate object supplied
     * by the configuration parser.
     *
     * @param sourceCandidate  the original source metadata (never {@code null})
     * @param definingResource the resource that defines the given source object
     *                         (may be {@code null})
     * @return the source metadata object to store (may be {@code null})
     */
    @Nullable
    Object extractSource(Object sourceCandidate, @Nullable Resource definingResource);

}
